<?php
require_once('../model/class.mlog.php');
$qiMlog = new qiMlog($DB);

if($ts == 'list')
{
$pageurl = '';
$page = isset($_GET['page']) ? abs(intval($_GET['page'])) : 1;
$pageurl .= './index.php?action=mlog&ts=list&page';

$mlogs = $qiMlog->getMlog($page,8);

$virtue = "id";
$setvirtue = "id";
$mlognum = $qiMlog->getLogNum($virtue, $setvirtue);

$page_url = pagination($mlognum, 8, $page, $pageurl);
}

if($ts == 'edit')
{
$logid = $_GET['id'];
$logDate = $qiMlog->getOneMlog($logid);
}

if($ts == 'update')
{
$logid = $_GET['id'];
$content = t($_POST['content']);

$logDate = array(
'content' => $content
);

$qiMlog->updateLog($logDate,$logid);
header("Location: index.php?action=mlog&ts=list");
}

if($ts == 'del')
{
$logid = $_GET['id'];
$qiMlog->deleteMlog($logid);
header("Location: index.php?action=mlog&ts=list");
}

?>